package com.star.sync.elasticsearch.execute;

import com.star.sync.elasticsearch.execute.torderinfo.TOrderInfoExecute;

/**
 * @author liu
 */
public class EsExecute<T> {

    private TOrderInfoExecute<T> tOrderInfoExecute;

    public EsExecute(TOrderInfoExecute tOrderInfoExecute) {
        this.tOrderInfoExecute = tOrderInfoExecute;
    }


    public T execute(String type, T t) throws Exception {
        switch (type) {
            case "insert":
                return tOrderInfoExecute.insert(t);
            case "update":
                return tOrderInfoExecute.update(t);
            case "delete":
                return tOrderInfoExecute.delete(t);
            default:
                return null;
        }
    }

}
